using System;
using Microsoft.SPOT;
using Netduino4Fun.Framework.ElectronicBrick;
using System.Threading;
using SecretLabs.NETMF.Hardware.NetduinoPlus;

namespace Netduino4Fun.Robot
{
    class RobotTestForwardBackwardController
    {
        PushButton button = new PushButton(Pins.GPIO_PIN_D8);
        WheelController wheelController = new WheelController();
        bool forward = false;

        public void Start()
        {
            this.button.Push += new Microsoft.SPOT.Hardware.NativeEventHandler(button_Push);

            Thread.Sleep(Timeout.Infinite);
        }

        void button_Push(uint data1, uint data2, DateTime time)
        {
            Debug.Print("Button click");

            forward = !forward;

            if (forward)
                wheelController.GoForward(50);
            else
                wheelController.GoBackward(50);
            Thread.Sleep(500);
        }
    }
}
